package edu.xmut.kakamusic.activity;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.github.appintro.AppIntro;
import com.github.appintro.AppIntroBaseFragment;
import com.github.appintro.AppIntroFragment;

import java.util.List;

import edu.xmut.kakamusic.R;

public class IntroductionActivity extends AppIntro {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        List<AppIntroFragment> list = List.of(
                AppIntroFragment.createInstance("第一天", "启动页、引导页、闪屏页", R.drawable.p1, R.color.main_color),
                AppIntroFragment.createInstance("第二天", "启动页、引导页、闪屏页", R.drawable.p2, R.color.main_color),
                AppIntroFragment.createInstance("第三天", "启动页、引导页、闪屏页", R.drawable.p3, R.color.main_color),
                AppIntroFragment.createInstance("第四天", "启动页、引导页、闪屏页", R.drawable.p4, R.color.main_color),
                AppIntroFragment.createInstance("第五天", "启动页、引导页、闪屏页", R.drawable.p5, R.color.main_color),
                AppIntroFragment.createInstance("第六天", "启动页、引导页、闪屏页", R.drawable.p6, R.color.main_color),
                AppIntroFragment.createInstance("第七天", "启动页、引导页、闪屏页", R.drawable.p7, R.color.main_color),
                AppIntroFragment.createInstance("第八天", "启动页、引导页、闪屏页", R.drawable.p8, R.color.main_color)
        );

        list.forEach(this::addSlide);
        setSkipText("跳过");
        setDoneText("完成");
        setImmersiveMode();
    }

    @Override
    protected void onSkipPressed(@Nullable Fragment currentFragment) {
        super.onSkipPressed(currentFragment);
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
        finish();
    }

    @Override
    protected void onDonePressed(@Nullable Fragment currentFragment) {
        super.onDonePressed(currentFragment);
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
        finish();
    }
}